/*
 * An XML document type.
 * Localname: controller
 * Namespace: urn:jbpm.org:jpdl-3.2
 * Java type: x2.orgJpdl3.jbpm.ControllerDocument
 *
 * Automatically generated - do not modify.
 */
package x2.orgJpdl3.jbpm.impl;
/**
 * A document containing one controller(@urn:jbpm.org:jpdl-3.2) element.
 *
 * This is a complex type.
 */
public class ControllerDocumentImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements x2.orgJpdl3.jbpm.ControllerDocument
{
    private static final long serialVersionUID = 1L;
    
    public ControllerDocumentImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName CONTROLLER$0 = 
        new javax.xml.namespace.QName("urn:jbpm.org:jpdl-3.2", "controller");
    
    
    /**
     * Gets the "controller" element
     */
    public x2.orgJpdl3.jbpm.Delegation getController()
    {
        synchronized (monitor())
        {
            check_orphaned();
            x2.orgJpdl3.jbpm.Delegation target = null;
            target = (x2.orgJpdl3.jbpm.Delegation)get_store().find_element_user(CONTROLLER$0, 0);
            if (target == null)
            {
                return null;
            }
            return target;
        }
    }
    
    /**
     * Sets the "controller" element
     */
    public void setController(x2.orgJpdl3.jbpm.Delegation controller)
    {
        synchronized (monitor())
        {
            check_orphaned();
            x2.orgJpdl3.jbpm.Delegation target = null;
            target = (x2.orgJpdl3.jbpm.Delegation)get_store().find_element_user(CONTROLLER$0, 0);
            if (target == null)
            {
                target = (x2.orgJpdl3.jbpm.Delegation)get_store().add_element_user(CONTROLLER$0);
            }
            target.set(controller);
        }
    }
    
    /**
     * Appends and returns a new empty "controller" element
     */
    public x2.orgJpdl3.jbpm.Delegation addNewController()
    {
        synchronized (monitor())
        {
            check_orphaned();
            x2.orgJpdl3.jbpm.Delegation target = null;
            target = (x2.orgJpdl3.jbpm.Delegation)get_store().add_element_user(CONTROLLER$0);
            return target;
        }
    }
}
